package spec.tianjunxiu.unit4.zuoyedongwu;

import java.text.SimpleDateFormat;
import java.util.Date;

public class Beijixiong extends Animal implements IAnimal , IHibernate{

    private String sj = "冬眠";

    Beijixiong(String n, String f, String a,String s) {
        super.eat();
        this.name = n;
        this.food = f;
        this.area = a;
        this.sj=s;
    }

    @Override
    String findFood() {

        return  this.name+"找"+this.food;
    }

    @Override
    void wholeLife() {
        System.out.println(born());
        System.out.println(eat());
        System.out.println(findFood());
        System.out.println(old());
        System.out.println(sick());
        System.out.println(die());
        System.out.println(hibernate());
    }

    @Override
    public String born() {
        String n = super.getName();
        SimpleDateFormat sf=new SimpleDateFormat("yyyy年MM月dd日 HH小时mm分ss秒");
        Date d=new Date();
        String DateString= sf.format(d);
        return n + "出生于" + DateString;
    }

    @Override
    public String old() {
        String n = super.getName();
        return n + "变老了";
    }

    @Override
    public String sick() {
        String n = super.getName();
        return n + "生病了";
    }

    @Override
    public String die() {
        String n = super.getName();
        return n + "死掉了";
    }

    @Override
    public String hibernate() {
        return "北极熊冬眠3个月!";
    }
}

